public class Test1 {
    public static void main(String[] args) {
        Solution sol = new Solution();

        System.out.println(sol.countSegments(", , , ,        a, eaefa"));
    }
}

class Solution {
    public int countSegments(String s) {
        if (s.equals("")) {
            return 0;
        }

        String[] strs = s.split(" ");

        int count = 0;
        for (int i = 0; i < strs.length; i++) {
            System.out.println(strs[i]);
        }
        for (int i = 0; i < strs.length; i++) {
            if (strs[i].length() != 0) {
                count++;
            }
        }
        return count;

        // int count = 0;
        // for (int i = 0; i < s.length(); i++) {
        //     if ()
        // }
    }
}